package com.ancient.base.page;

import com.github.pagehelper.PageInfo;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * 分页
 *
 * @author user
 *
 */
@Data
@NoArgsConstructor
public class Page {
	/**
	 * 每页多少条记录
	 */
	private int pageSize;
	/**
	 * 总计记录数
	 */
	private int totalRecords;
	/**
	 * 总页数
	 */
	private int totalPages;
	/**
	 * 当前页
	 */
	private int currentPage;

	public Page(PageInfo<?> page) {
		this.pageSize = page.getPageSize();
		this.totalRecords = (int) page.getTotal();
		this.totalPages = page.getPages();
		this.currentPage = page.getPageNum();
	}
}
